#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QApplication>


MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    m_translatorEnglish.load("zh_CN.qm");
    m_translatorEnglish.load("en.qm");
    QApplication::instance()->installTranslator(&m_translatorChinese);

    ui->setupUi(this);


}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_clicked()
{
    ui->label->setText(tr("demo"));
}

void MainWindow::on_pushButtonCN_clicked()
{
    QApplication::instance()->removeTranslator(&m_translatorEnglish);
    QApplication::instance()->installTranslator(&m_translatorChinese);

    ui->retranslateUi(this);
}

void MainWindow::on_pushButtonEn_clicked()
{
    QApplication::instance()->removeTranslator(&m_translatorChinese);
    QApplication::instance()->installTranslator(&m_translatorEnglish);

    ui->retranslateUi(this);
}

void MainWindow::on_pushButtonClear_clicked()
{
    QApplication::instance()->removeTranslator(&m_translatorChinese);
    QApplication::instance()->removeTranslator(&m_translatorEnglish);

    ui->retranslateUi(this);
}
